home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earcd / grafica / ghostscript / 5.10 / gs_cff.ps < prev    next >
Text File  |  1997-12-28  |  19KB  |  606 lines

  1. %    Copyright (C) 1997 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % Loader for CFF (compressed) fonts.
  16. % The following are not implemented yet:
  17. %    Deleted entries in the Name Index
  18. %    Embedded PostScript
  19. %    Multiple Master fonts
  20. %    CIDFonts
  21. %    Chameleon fonts
  22. %    Synthetic fonts
  23. % Also, Type 2 charstrings are converted into Type 1 fonts with
  24. % CharstringType = 2, which may or may not be supported.
  25.  
  26. 30 dict begin
  27.  
  28. % ---------------- Standard strings (actually names) ---------------- %
  29.  
  30. /StandardStrings mark
  31. % 0
  32.   /.notdef /space /exclam /quotedbl /numbersign
  33.   /dollar /percent /ampersand /quoteright /parenleft
  34.   /parenright /asterisk /plus /comma /hyphen
  35.   /period /slash /zero /one /two
  36.   /three /four /five /six /seven
  37.   /eight /nine /colon /semicolon /less
  38.   /equal /greater /question /at /A
  39.   /B /C /D /E /F
  40.   /G /H /I /J /K
  41.   /L /M /N /O /P
  42. % 50
  43.   /Q /R /S /T /U
  44.   /V /W /X /Y /Z
  45.   /bracketleft /backslash /bracketright /asciicircum /underscore
  46.   /quoteleft /a /b /c /d
  47.   /e /f /g /h /i
  48.   /j /k /l /m /n
  49.   /o /p /q /r /s
  50.   /t /u /v /w /x
  51.   /y /z /braceleft /bar /braceright
  52.   /asciitilde /exclamdown /cent /sterling /fraction
  53. % 100
  54.   /yen /florin /section /currency /quotesingle
  55.   /quotedblleft /guillemotleft /guilsinglleft /guilsinglright /fi
  56.   /fl /endash /dagger /daggerdbl /periodcentered
  57.   /paragraph /bullet /quotesinglbase /quotedblbase /quotedblright
  58.   /guillemotright /ellipsis /perthousand /questiondown /grave
  59.   /acute /circumflex /tilde /macron /breve
  60.   /dotaccent /dieresis /ring /cedilla /hungarumlaut
  61.   /ogonek /caron /emdash /AE /ordfeminine
  62.   /Lslash /Oslash /OE /ordmasculine /ae
  63.   /dotlessi /lslash /oslash /oe /germandbls
  64. % 150
  65.   /onesuperior /logicalnot /mu /trademark /Eth
  66.   /onehalf /plusminus /Thorn /onequarter /divide
  67.   /brokenbar /degree /thorn /threequarters /twosuperior
  68.   /registered /minus /eth /multiply /threesuperior
  69.   /copyright /Aacute /Acircumflex /Adieresis /Agrave
  70.   /Aring /Atilde /Ccedilla /Eacute /Ecircumflex
  71.   /Edieresis /Egrave /Iacute /Icircumflex /Idieresis
  72.   /Igrave /Ntilde /Oacute /Ocircumflex /Odieresis
  73.   /Ograve /Otilde /Scaron /Uacute /Ucircumflex
  74.   /Udieresis /Ugrave /Yacute /Ydieresis /Zcaron
  75. % 200
  76.   /aacute /acircumflex /adieresis /agrave /aring
  77.   /atilde /ccedilla /eacute /ecircumflex /edieresis
  78.   /egrave /iacute /icircumflex /idieresis /igrave
  79.   /ntilde /oacute /ocircumflex /odieresis /ograve
  80.   /otilde /scaron /uacute /ucircumflex /udieresis
  81.   /ugrave /yacute /ydieresis /zcaron /exclamsmall
  82.   /Hungarumlautsmall /dollaroldstyle /dollarsuperior /ampersandsmall /Acutesmall
  83.   /parenleftsuperior /parenrightsuperior /twodotenleader /onedotenleader /zerooldstyle
  84.   /oneoldstyle /twooldstyle /threeoldstyle /fouroldstyle /fiveoldstyle
  85.   /sixoldstyle /sevenoldstyle /eightoldstyle /nineoldstyle /commasuperior
  86. % 250
  87.   /threequartersemdash /periodsuperior /questionsmall /asuperior /bsuperior
  88.   /centsuperior /dsuperior /esuperior /isuperior /lsuperior
  89.   /msuperior /nsuperior /osuperior /rsuperior /ssuperior
  90.   /tsuperior /ff /ffi /ffl /parenleftinferior
  91.   /parenrightinferior /Circumflexsmall /hyphensuperior /Gravesmall /Asmall
  92.   /Bsmall /Csmall /Dsmall /Esmall /Fsmall
  93.   /Gsmall /Hsmall /Ismall /Jsmall /Ksmall
  94.   /Lsmall /Msmall /Nsmall /Osmall /Psmall
  95.   /Qsmall /Rsmall /Ssmall /Tsmall /Usmall
  96.   /Vsmall /Wsmall /Xsmall /Ysmall /Zsmall
  97. % 300
  98.   /colonmonetary /onefitted /rupiah /Tildesmall /exclamdownsmall
  99.   /centoldstyle /Lslashsmall /Scaronsmall /Zcaronsmall /Dieresissmall
  100.   /Brevesmall /Caronsmall /Dotaccentsmall /Macronsmall /figuredash
  101.   /hypheninferior /Ogoneksmall /Ringsmall /Cedillasmall /questiondownsmall
  102.   /oneeighth /threeeighths /fiveeighths /seveneighths /onethird
  103.   /twothirds /zerosuperior /foursuperior /fivesuperior /sixsuperior
  104.   /sevensuperior /eightsuperior /ninesuperior /zeroinferior /oneinferior
  105.   /twoinferior /threeinferior /fourinferior /fiveinferior /sixinferior
  106.   /seveninferior /eightinferior /nineinferior /centinferior /dollarinferior
  107.   /periodinferior /commainferior /Agravesmall /Aacutesmall /Acircumflexsmall
  108. % 350
  109.   /Atildesmall /Adieresissmall /Aringsmall /AEsmall /Ccedillasmall
  110.   /Egravesmall /Eacutesmall /Ecircumflexsmall /Edieresissmall /Igravesmall
  111.   /Iacutesmall /Icircumflexsmall /Idieresissmall /Ethsmall /Ntildesmall
  112.   /Ogravesmall /Oacutesmall /Ocircumflexsmall /Otildesmall /Odieresissmall
  113.   /OEsmall /Oslashsmall /Ugravesmall /Uacutesmall /Ucircumflexsmall
  114.   /Udieresissmall /Yacutesmall /Thornsmall /Ydieresissmall (001.000)
  115.   (001.001) (001.002) (001.003) /Black /Bold
  116.   /Book /Light /Medium /Regular /Roman
  117.   /Semibold
  118. .packtomark def
  119.  
  120. % ---------------- Standard encodings ---------------- %
  121.  
  122. /StandardEncodings [
  123.  
  124. % StandardEncoding
  125. mark
  126.   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  127.   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  128.   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
  129.   17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  130.   33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
  131.   49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
  132.   65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
  133.   81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 0
  134.   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  135.   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  136.   0 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
  137.   0 111 112 113 114 0 115 116 117 118 119 120 121 122 0 123
  138.   0 124 125 126 127 128 129 130 131 0 132 133 0 134 135 136
  139.   137 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  140.   0 138 0 139 0 0 0 0 140 141 142 143 0 0 0 0
  141.   0 144 0 0 0 145 0 0 146 147 148 149 0 0 0 0
  142. .packtomark
  143.  
  144. % ExpertEncoding
  145. mark
  146.   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  147.   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  148.   1 229 230 0 231 232 233 234 235 236 237 238 13 14 15 99
  149.   239 240 241 242 243 244 245 246 247 248 27 28 249 250 251 252
  150.   0 253 254 255 256 257 0 0 0 258 0 0 259 260 261 262
  151.   0 0 263 264 265 0 266 109 110 267 268 269 0 270 271 272
  152.   273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
  153.   289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 0
  154.   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  155.   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  156.   0 304 305 306 0 0 307 308 309 310 311 0 312 0 0 313
  157.   0 0 314 315 0 0 316 317 318 0 0 0 158 155 163 319
  158.   320 321 322 323 324 325 0 0 326 150 164 169 327 328 329 330
  159.   331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
  160.   347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
  161.   363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
  162. .packtomark
  163.  
  164. ] readonly def
  165.  
  166. % ---------------- Standard Charsets ---------------- %
  167.  
  168. % We include an explicit 0 at the beginning of each charset.
  169.  
  170. /StandardCharsets [
  171.  
  172. % ISOAdobe
  173. mark
  174.   0
  175.   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
  176.   17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  177.   33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
  178.   49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
  179.   65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
  180.   81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
  181.   97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
  182.   113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
  183.   129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
  184.   145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
  185.   161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
  186.   177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
  187.   193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
  188.   209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
  189.   225 226 227 228
  190. .packtomark
  191.  
  192. % Expert
  193. mark
  194.   0
  195.   1 229 230 231 232 233 234 235 236 237 238 13 14 15 99 239
  196.   240 241 242 243 244 245 246 247 248 27 28 249 250 251 252 253
  197.   254 255 256 257 258 259 260 261 262 263 264 265 266 109 110 267
  198.   268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
  199.   284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
  200.   300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
  201.   316 317 318 158 155 163 319 320 321 322 323 324 325 326 150 164
  202.   169 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
  203.   342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
  204.   358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
  205.   374 375 376 377 378
  206. .packtomark
  207.  
  208. % ExpertSubset
  209. mark
  210.   0
  211.   1 231 232 235 236 237 238 13 14 15 99 239 240 241 242 243
  212.   244 245 246 247 248 27 28 249 250 251 253 254 255 256 257 258
  213.   259 260 261 262 263 264 265 266 109 110 267 268 269 270 272 300
  214.   301 302 305 314 315 158 155 163 320 321 322 323 324 325 326 150
  215.   164 169 327 328 329 330 331 332 333 334 335 336 337 338 339 340
  216.   341 342 343 344 345 346
  217. .packtomark
  218.  
  219. ] readonly def
  220.  
  221. % ---------------- Font loading ---------------- %
  222.  
  223. % ------ Utilities ------ %
  224.  
  225. /advance {    % <n> advance -
  226.   f cff eq { /pos pos 3 -1 roll add store } { pop } ifelse
  227. } def
  228. /next {        % - next <byte>
  229.   f read { 1 advance } if
  230. } def
  231. /nextstring {    % <length> nextstring <string>
  232.   dup 0 eq {
  233.     pop ()
  234.   } {
  235.     string f exch readstring pop dup length advance
  236.   } ifelse
  237. } def
  238. /card8        % - card8 <card8>
  239.  /next load
  240. def
  241. /card16 {    % - card16 <card16>
  242.   card8 8 bitshift card8 add
  243. } def
  244. /offset {    % <offsize> offset <offset>
  245.   0 exch { 8 bitshift next add } repeat
  246. } def
  247. /sid        % - <sid> sid
  248.   /card16 load
  249. def
  250. /Index {    % - Index <array>
  251.   mark card16 dup 0 ne {
  252.     1 exch next dup offset pop exch {
  253.       dup offset dup 4 -1 roll sub 3 1 roll exch
  254.     } repeat pop
  255.   } if pop .packtomark
  256.   [ exch { nextstring } forall ] readonly
  257. } def
  258. /tokens {    % - tokens <num1> ... <op#> (op# = 12 means EOF)
  259.   {
  260.     f read not { 12 exit } if
  261.     1 advance
  262.     dup 12 eq { pop next 32 add exit } if
  263.     dup 28 lt { exit } if
  264.     dup 32 lt {
  265.       28 sub {
  266.     { card16 32768 xor 32768 sub }
  267.     { 4 offset dup 16#7fffffff gt { -1 32 bitshift add } if }
  268.     { tokenreal }
  269.     { 31 exit }
  270.       } exch get exec
  271.     } {
  272.       dup 247 lt {
  273.     139 sub
  274.       } {
  275.     247 sub {
  276.       { next 108 add }
  277.       { next 364 add }
  278.       { next 620 add }
  279.       { next 876 add }
  280.       { next 108 add neg }
  281.       { next 364 add neg }
  282.       { next 620 add neg }
  283.       { next 876 add neg }
  284.       % 255 is deliberately omitted and will cause a rangecheck
  285.     } exch get exec
  286.       } ifelse
  287.     } ifelse
  288.   } loop
  289. } def
  290. /tokenbuf 100 string def
  291. /tokenput {    % <index> <char> tokenput <index+1>
  292.   tokenbuf 2 index 3 -1 roll put 1 add
  293. } def
  294. /tokenrealarray [
  295.  (0123456789.E) { } forall
  296.  [(E) 0 get /tokenput cvx (-) 0 get] cvx
  297.  null        % will give an error
  298.  (-) 0 get
  299.  { exit }
  300. ] readonly def
  301. /tokenreal {    % - tokenreal <float>
  302.   0 {
  303.     next exch 1 index -4 bitshift tokenrealarray exch get exec tokenput
  304.         % We must leave the byte on the stack temporarily so that
  305.         % the exit will see a consistent stack state.
  306.     1 index 15 and tokenrealarray exch get exec tokenput exch pop
  307.   } loop
  308.   tokenbuf 0 3 -1 roll getinterval cvr exch pop
  309. } def
  310. /Dict {        % <opsdict> Dict -
  311.   /opdict exch store {
  312.     mark tokens opdict exch .knownget { exec } if cleartomark
  313.   } loop cleartomark
  314. } def
  315. /idstring {    % <sid> idstring <string|name>
  316.   dup 391 lt { StandardStrings } { 391 sub strings } ifelse exch get
  317. } def
  318. /idname {    % <sid> idname <name>
  319.   idstring dup type /nametype ne { cvn } if
  320. } def
  321.  
  322. % ------ Top dictionary ------ %
  323.  
  324. /offput {    % <offset> <proc> offput -
  325.   currentdict exch aload length 1 add packedarray cvx
  326.   offsets 3 1 roll put
  327. } def
  328. /queueput {    % <font> <proc> queueput -
  329.   16#7fffffff offsets { pop .min } forall
  330.   pos sub nextstring
  331.   3 1 roll aload length 2 add packedarray cvx
  332.   [ queued aload pop counttomark 2 add -1 roll ]
  333.   /queued exch store
  334. } def
  335. /xxput {    % <value> <key> <dict> xxput -
  336.   3 1 roll exch put
  337. } def
  338. /putfi {    % <value> <key> putfi -
  339.   FontInfo xxput
  340. } def
  341. /xdef {        % <value> <key> xdef -
  342.   exch def
  343. } def
  344. /topdictops mark
  345.   12 { exit }
  346.   0 { idstring /version putfi }
  347.   1 { idstring /Notice putfi }
  348.   32 { idstring /Copyright putfi }
  349.   2 { idstring /FullName putfi }
  350.   3 { idstring /FamilyName putfi }
  351.   4 { idstring /Weight putfi }
  352.   33 { 0 ne /isFixedPitch putfi }
  353.   34 { /ItalicAngle putfi }
  354.   35 { /UnderlinePosition putfi }
  355.   36 { /UnderlineThickness putfi }
  356.   37 { /PaintType xdef }
  357.   38 { /CharstringType xdef }
  358.   39 { counttomark array astore /FontMatrix xdef }
  359.   13 { /UniqueID xdef }
  360.   5 { counttomark array astore /FontBBox xdef }
  361.   40 { /StrokeWidth xdef }
  362.   14 { counttomark array astore /XUID xdef }
  363.   15 {
  364.     dup StandardCharsets length lt {
  365.       StandardCharsets exch get /charset xdef
  366.     } {
  367.       { queuecharset } offput
  368.     } ifelse
  369.   }
  370.   16 {
  371.     dup StandardEncodings length lt {
  372.       /Encoding xdef
  373.     } {
  374.       { queueEncoding } offput
  375.     } ifelse
  376.   }
  377.   17 { { readCharStrings } offput }
  378.   18 { exch /readPrivate cvx 2 packedarray offput }
  379. .dicttomark readonly def
  380.  
  381. /readCharStrings {    % <font> readCharStrings -
  382.   /CharStringArray Index put
  383. } def
  384.  
  385. % ------ Charsets and encodings ------ %
  386.  
  387. % Note: formats 1 and 2 can overflow the operand stack.
  388. % We'll fix this if it ever becomes necessary.
  389. /charsetformats [
  390. { [ 0 CharStringArray length 1 sub { sid } repeat ]
  391. }
  392. { [ 0 CharStringArray length 1 sub {
  393.     dup 0 eq { pop exit } if
  394.     sid card8 1 add 2 index .min { exch 1 sub 1 index 1 add } repeat pop
  395.   } loop ]
  396. }
  397. { [ 0 CharStringArray length 1 sub {
  398.     dup 0 eq { pop exit } if
  399.     sid card16 1 add 2 index .min { exch 1 sub 1 index 1 add } repeat pop
  400.   } loop ]
  401. }
  402. ] readonly def
  403. /queuecharset {        % <font> queuecharset -
  404.   { readcharset } queueput
  405. } def
  406. /readcharset {        % <data> <font> readcharset -
  407.   begin 0 () /SubFileDecode filter /f exch store
  408.   charsetformats next get exec /charset exch def end
  409. } def
  410.  
  411. /encodingformats [
  412. { 1 1 next { next exch Encoding 3 1 roll put } for
  413. }
  414. { 1 next {
  415.     next next 1 add {
  416.             % Stack: gid code
  417.       Encoding 1 index 3 index put
  418.       exch 1 add exch 1 add
  419.     } repeat pop
  420.   } repeat pop
  421. }
  422. ] readonly def
  423. /queueEncoding {    % <font> queueEncoding -
  424.   { readEncoding } queueput
  425. } def
  426. /readEncoding {        % <data> <font> readEncoding -
  427.   begin 0 () /SubFileDecode filter /f exch store
  428.   /Encoding [ 256 { /.notdef } repeat ] def
  429.   next encodingformats 1 index 127 and get exec
  430.   128 ge {
  431.             % Read supplementary encodings.
  432.     next {
  433.       Encoding next sid idname put
  434.     } repeat
  435.   } if end
  436. } def
  437.  
  438. % ------ Private dictionary ------ %
  439.  
  440. /deltarray {        % -mark- <num1> ... deltarray <num1'> ...
  441.   0 counttomark 1 sub { counttomark -1 roll add dup } repeat pop
  442.   counttomark array astore
  443. } def
  444.  
  445. /privatedictops mark
  446.   12 { exit }
  447.   6 { deltarray /BlueValues xdef }
  448.   7 { deltarray /OtherBlues xdef }
  449.   8 { deltarray /FamilyBlues xdef }
  450.   9 { deltarray /FamilyOtherBlues xdef }
  451.   41 { /BlueScale xdef }
  452.   42 { /BlueShift xdef }
  453.   43 { /BlueFuzz xdef }
  454.   10 { 1 array astore /StdHW xdef }
  455.   11 { 1 array astore /StdVW xdef }
  456.   44 { deltarray /StemSnapH xdef }
  457.   45 { deltarray /StemSnapV xdef }
  458.   46 { 0 ne /ForceBold xdef }
  459.   47 { /ForceBoldThreshold xdef }
  460.   48 { /lenIV xdef }
  461.   49 { /LanguageGroup xdef }
  462.   50 { /ExpansionFactor xdef }
  463.   51 { /initialRandomSeed xdef }
  464.   19 { { readSubrs } offput }
  465.   20 { /defaultWidthX xdef }
  466.   21 { /nominalWidthX xdef }
  467.     % Multiple Master fonts only
  468.   59 { /NDV xdef }
  469.   60 { /CDV xdef }
  470.   61 { /lenBuildCharArray xdef }
  471. .dicttomark readonly def
  472.  
  473. /readPrivate {        % <font> <size> readPrivate -
  474.   exch 1 index f exch () /SubFileDecode filter /f exch def
  475.   /Private get begin //privatedictops Dict end
  476.   /f cff def advance
  477. } def
  478.  
  479. % ------ Main program ------ %
  480.  
  481. % We need to pass the file as a parameter for the sake of the PDF
  482. % interpreter.
  483. /StartData {        % <resname> <nbytes> StartData -
  484.   currentfile exch () /SubFileDecode filter ReadData
  485. } def
  486. /ReadData {        % <resname> <file> ReadData -
  487.  
  488.     % Initialize.
  489.  
  490.   30 dict begin
  491.   /cff exch def
  492.   /pos 0 def
  493.   /resname exch cvlit def
  494.  
  495.     % Read the header.
  496.  
  497.   /f cff def
  498.   /vmajor next def
  499.   /vminor next def
  500.   /hdrsize next def
  501.   /aoffsize next def
  502.  
  503.     % Read the Indexes.
  504.  
  505.   /names Index def
  506.   /topdicts Index def
  507.   /strings Index def
  508.   /gsubrs Index def
  509.  
  510.     % Read the top Dicts.
  511.  
  512.   /offsets 50 dict def
  513.   /queued [] def
  514.   /opdict null def        % reserve a slot
  515.   /fonts [ topdicts {
  516.     0 () /SubFileDecode filter /f exch def
  517.     40 dict begin
  518.         % Preload defaults that differ from PostScript defaults.
  519.       /FontType 1 def
  520.       /CharstringType 2 def
  521.       /FontMatrix [0.001 0 0 0.001 0 0] def
  522.       /charset StandardCharsets 0 get def
  523.       /Encoding 0 def
  524.       /FontInfo 10 dict
  525.     dup /UnderlinePosition -100 put
  526.     dup /UnderlineThickness 50 put
  527.       def
  528.       /Private 20 dict
  529.     gsubrs length 0 ne { dup /GlobalSubrs gsubrs put } if
  530.       def
  531.       //topdictops Dict
  532.     currentdict end
  533.   } forall ] def
  534.  
  535.     % Read other tables with queued offsets.
  536.  
  537.   { /f cff def
  538.     offsets pos 2 copy .knownget not { pop pop exit } if
  539.     3 1 roll undef exec
  540.   } loop
  541.   offsets length 0 ne {
  542.     (Error: missing tables at ) print [ offsets { pop } forall ] ==
  543.     (Current position is ) print pos ==
  544.     flush stop
  545.   } if
  546.  
  547.     % Process out-of-order tables.
  548.  
  549.   queued { exec } forall
  550.  
  551.     % Update Encoding and CharStrings.
  552.  
  553.   fonts {
  554.     begin
  555.         % Construct the real Encoding.
  556.         % The value of Encoding is either a number, for predefined
  557.         % encodings, or an array of mixed GIDs and names.
  558.       /Encoding mark Encoding dup type /integertype eq {
  559.     StandardEncodings exch get { idname } forall
  560.       } {
  561.     {
  562.       dup type /integertype eq { charset exch get idname } if
  563.         } forall
  564.       } ifelse .packtomark def
  565.         % Construct the CharStrings.
  566.       /CharStrings charset length dict def
  567.       0 1 charset length 1 sub {
  568.     dup CharStringArray exch get
  569.     exch charset exch get idstring
  570.     CharStrings xxput
  571.       } for
  572.         % Remove unwanted entries.
  573.       currentdict /charset undef
  574.       currentdict /CharSetArray undef
  575.     end
  576.   } forall
  577.  
  578.     % Wrap up.
  579.  
  580.   resname mark 0 1 fonts length 1 sub {
  581.     dup names exch get exch fonts exch get
  582.     dup /FontName 3 index put
  583.     1 index exch definefont
  584.   } for .dicttomark
  585.   end        % temporary dict
  586.   end        % FontSetInit ProcSet
  587.   /FontSet defineresource pop
  588.  
  589. } bind def
  590.  
  591. % ---------------- Resource category definition ---------------- %
  592.  
  593. currentdict end readonly
  594.  
  595. languagelevel exch 2 .setlanguagelevel
  596.  
  597. /FontSet /Generic /Category findresource dup length dict .copydict
  598. /Category defineresource pop
  599.  
  600. /FontSetInit exch /ProcSet defineresource pop
  601.  
  602. .setlanguagelevel
  603.